#include "stdafx.h"

#include "PointLight.h"

namespace PM3D
{
    PointLight::PointLight(const D3DXCOLOR& ambient,const D3DXCOLOR& diffuse,
            const D3DXCOLOR& specular, const D3DXVECTOR3& position, 
            const D3DXVECTOR3& attenuation, const float range) 
         : Light(ambient,diffuse,specular)
    {
        light_.Type = D3DLIGHT_POINT;

        light_.Position = position;
        light_.Attenuation0 = attenuation.x;
        light_.Attenuation1 = attenuation.y;
        light_.Attenuation2 = attenuation.z;
        light_.Range  = range;
    }

    PointLight::~PointLight()
    {
    }

    ///////////////////////////////////////////////////
    // Getter
    ///////////////////////////////////////////////////
    D3DXVECTOR3 PointLight::getPosition() const
    {
        return light_.Position;
    }
    
    D3DXVECTOR3 PointLight::getAttenuation() const
    {
        return D3DXVECTOR3(light_.Attenuation0, light_.Attenuation1, light_.Attenuation2);
    }

    float PointLight::getRange() const
    {
        return light_.Range;
    }

    ///////////////////////////////////////////////////
    // Setter
    ///////////////////////////////////////////////////
    void PointLight::setPosition(const D3DXVECTOR3& position)
    {
        light_.Position = position;
    }

    void PointLight::setAttenuation(const float attenuation)
    {
        light_.Attenuation0 = attenuation;
    }

    void PointLight::setRange(const float range)
    {
        light_.Range = range;
    }

}//namespace PM3D
